// Copyright DustedPixels.com 2008. All rights reserved.

package com.dustedpixels.jasmin.unit.compiler;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class FieldLine {
  public enum Type {UNIT, OTHER};
  
  public String name;
  public String code;
  public Type type;
  
  public FieldLine(Type type, String name, String code) {
    this.name = name;
    this.code = code;
    this.type = type;
  }
  
  public FieldLine compiled(String targetName) {
    String compiledCode = code
        .replaceAll(name, targetName + "_" + name)
        .replaceAll("public ", "private ");
    return new FieldLine(type, targetName + "_" + name, compiledCode);
  }
}
